package org.design.flyweightPattern;

import java.util.HashMap;

/**
 * ShapeFactory
 *
 * @author 樊温军
 * @date 2025/6/16 下午5:56
 */
public class ShapeFactory {
    private static final HashMap<String, Shape> CIRCLE_MAP = new HashMap<>();

    public static Shape getCircle(String color) {
        Circle circle = (Circle)CIRCLE_MAP.get(color);

        if(circle == null) {
            circle = new Circle(color);
            CIRCLE_MAP.put(color, circle);
            System.out.println("画圆圈的颜色 : " + color);
        }
        return circle;
    }
}
